﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Central_Control
{
    /// <summary>
    /// LoginWindow.xaml 的交互逻辑
    /// </summary>
    public partial class LoginWindow : Window
    {
     
        public LoginWindow()
        {
            InitializeComponent();
            this.DataContext = this;
        }

        //判断输入管理员的密码是否正确
        private void Login_Click(object sender, RoutedEventArgs e)
        {
            if (Password.Password=="666")
            {
                Password.Clear();
                this.Hide();
                SetWindow setWindow = new SetWindow();
                setWindow.Owner = this; // 设置新窗口的Owner为当前窗口
                setWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; // 设置新窗口在Owner窗口中间打开
                MainWindow.instance.IsCloseButtonVisible = Visibility.Visible;
                setWindow.ShowDialog();
                
            }
            else
            {
                MessageBox.Show("密码错误");
                Password.Password = "";
                Password.Clear();
            }
        }

    }
}

